//
//  HaoBaZiyuanHomeVC.m
//  HaoBaShengxinEn
//
//  Created by 暗流澎涌 on 2024/6/18.
//

#import "HaoBaZiyuanHomeVC.h"
#import "HaoBaZYCell.h"
#import "HaoBaNewWebVC.h"
#import "FYWechatController.h"
#import "RequestManager.h"
#import "HaoBaManager.h"
#import "SVProgressHUD.h"
@interface HaoBaZiyuanHomeVC ()<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *HaoBaTableView;

@end

@implementation HaoBaZiyuanHomeVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.navigationController setNavigationBarHidden:YES];
    [self creatUIHaoba];
}
-(void)creatUIHaoba{
    self.HaoBaTableView.separatorStyle =  UITableViewCellSeparatorStyleNone;
    
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return  1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 5;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    HaoBaZYCell* cell=[self.HaoBaTableView dequeueReusableCellWithIdentifier:NSStringFromClass([HaoBaZYCell class])];
    if (cell==nil) {
        cell=[[[NSBundle mainBundle]loadNibNamed:NSStringFromClass([HaoBaZYCell class]) owner:nil options:nil] firstObject];
    }
    cell.selectionStyle=UITableViewCellSelectionStyleNone;
    cell.ItemImageV.image = [UIImage imageNamed:[NSString stringWithFormat:@"haoBa_zy_%ld",indexPath.row+1]];
    return  cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    [[RequestManager sharedInstance] saveRequeseWithKey:SaveRequestTypeClick];
    BOOL isHave =  [HaoBaManager GetHaveFL] ;
    if (isHave) {
        [FYWechatController nowPresent];
    }else{
        [SVProgressHUD showErrorWithStatus:@"该福利已结束，感谢关注"];
    }
//    HaoBaNewWebVC * HWwebvc = [HaoBaNewWebVC new];
//    HWwebvc.HBUrl = [NSString stringWithFormat:@"http://haoba.hgktc.cn/english/ios/haoba/#/resourse??categoryId=%ld&lessonId=%ld",51+indexPath.row,1+indexPath.row];
//    HWwebvc.hidesBottomBarWhenPushed = YES;
//    [self.navigationController pushViewController:HWwebvc animated:YES];
//    
    
}

@end
